import { create } from 'zustand';

interface ActionSheetState {
  visibleUid: string; // which instance is currently visible; empty means none
  isTabbarPage: boolean; // 是否是 tabbar 页面，用于额外底部 padding
}

interface ActionSheetActions {
  setIsTabbarPage: (v: boolean) => void;
  open: (uid: string) => void;
  close: () => void;
  reset: () => void;
}

export type ActionSheetStore = ActionSheetState & ActionSheetActions;

export const useActionSheetStore = create<ActionSheetStore>((set) => ({
  visibleUid: '',
  isTabbarPage: false,
  setIsTabbarPage: (v) => set({ isTabbarPage: v }),
  open: (uid) => set({ visibleUid: uid }),
  close: () => set({ visibleUid: '' }),
  reset: () => set({ visibleUid: '', isTabbarPage: false }),
}));
